<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>牧心农业</title>
    <link rel="stylesheet" type="text/css" href="/static/css/eui.css" />
    <link rel="stylesheet" type="text/css" href="/static/css/mobile.css" />
    <link rel="stylesheet" type="text/css" href="/static/css/iconfont.css" />
    <script src="/static/js/jquery.min.js"></script>
    <script src="/static/js/swipe.js"></script>
    <script src="/static/js/doT.min.js"></script>
    <script src="/static/js/func.js"></script>
</head>
<body>
    <div class="content margin_top">
        <header class="header fixed_top bg_mx_green"></header>
        <div class="swipe">
            <div class='swipe-wrap'></div>
            <ul class="position"></ul>
        </div>
        <div class="detail"></div>
    </div>
    <script type="text/template" charset="utf-8" id='swipe_template'></script>
    <script type="text/template" charset="utf-8" id='detail_template'>
        <div class="bg_white margin_b_10">
            <div class="row padding_10_15">
                <div class="col_6">猪种：{{=it.type}}</div>
                <div class="col_6">入栏时间：{{=it.period}}</div>
                <div class="col_6">养殖户：{{=it.operator}}</div>
                <div class="col_6">领养人：{{=it.owner}}</div>
                <div class="col_6">状态：{{=it.status}}</div>
            </div>
        </div>
        <div class="row text_center bg_white margin_b_10 padding_10_15">

            {{if(it.oldstatus != 7){}}
                {{if(it.oldstatus==2 && it.oldstatus!=3){}}
                <div class="col_4 margin_b_10" onclick="location.href='<{url route='/business/person/put-inspection' pigid=$pigid}>'">
                    <span class="label_mx_green padding_h_10">常规巡检</span>
                </div>
                {{}}}

                {{if(it.oldstatus!=3){}}
                <div class="col_4 margin_b_10" onclick="location.href='<{url route='/business/person/vaccine' pigid=$pigid}>'">
                    <span class="label_mx_green padding_h_10">添加疫苗</span>
                </div>
                {{}}}

                <div class="col_4 margin_b_10" onclick="location.href='<{url route='/business/person/cost' pigid=$pigid}>'">
                    <span class="label_mx_green padding_h_10">添加成本</span>
                </div>

                {{if(it.oldstatus!=3){}}
                <div class="col_4" onclick="location.href='<{url route='/business/person/pig-exception' pigid=$pigid}>'">
                    <span class="label_mx_green padding_h_10">异常处理</span>
                </div>
                {{}}}

                {{if(it.oldstatus==2 && it.oldstatus!=3){}}
                <div class="col_4" onclick="location.href='<{url route='/business/person/pig-out' pigid=$pigid}>'">
                    <span class="label_mx_green padding_h_10">出栏登记</span>
                </div>
                {{}}}

                {{if(it.oldstatus>=3){}}
                <div class="col_4" onclick="location.href='<{url route='/business/person/price-track' pigid=$pigid}>'">
                    <span class="label_mx_green padding_h_10">价格跟踪</span>
                </div>
                {{}}}

                {{if(it.oldstatus==2 && it.oldstatus!=3){}}
                <div class="col_4 margin_b_10" onclick="location.href='<{url route='/business/person/disease' pigid=$pigid}>'">
                    <span class="label_mx_green padding_h_10">疾病录入</span>
                </div>
                {{}}}
            {{}}}

        </div>
        <div class="bg_white lineheight_4">
            <div class="arrow_down padding_h_15 border_b from_nav">档案</div>
            <div class="padding_15 font_12 lineheight_2 hide">
                <div class="">猪场合同编号：{{=it.contract_no}}</div>
                <!--<div class="">猪场：{{=it.slaughterhouse}}</div>-->
                <div class="">批次：{{=it.no}}</div>
                <div class="">代养地址：{{=it.address}}</div>
                <div class="flex_row_2">
                    <div class="row_one">
                        <div class="">父本编号:{{=it.f_no}}</div>
                        <img class="fit_img" src="{{=it.f_img}}" alt="">
                    </div>
                    <div class="row_one">
                        <div class="">母本编号:{{=it.m_no}}</div>
                        <img class="fit_img" src="{{=it.m_img}}" alt="">
                    </div>
                </div>
            </div>
            <div class="arrow_down padding_h_15 border_b from_nav">生长环境</div>
            <div class="padding_15 flex_row_4" style="display:none">
                {{for(var i=0;i<it.surroundings.length;i++){}}
                <div class="row_one surrounding_img">
                    <img class="fit_img2" src="{{=it.surroundings[i]}}" alt="">
                </div>
                {{}}}
            </div>
            <div class="arrow_down padding_h_15 border_b from_nav">巡检记录</div>
            <div class="padding_h_15 font_12 light hide">
                {{for(var i=0;i<it.records.length;i++){}}
                <div class="h_justify border_b" onclick="location.href='{{=it.records[i].url}}'">
                    <div>{{=it.records[i].title}}</div>
                    <div>第{{=it.records[i].no}}次常规巡检</div>
                    <div>巡检人：{{=it.records[i].who}}</div>
                </div>
                {{}}}
            </div>
            <div class="arrow_down padding_h_15 border_b from_nav">疫苗情况</div>
            <div class="padding_h_15 font_12 light hide lineheight_2">
                {{for(var i=0;i<it.vaccine.length;i++){}}
                <div class="padding_v_10 border_b">
                    <div>{{=it.vaccine[i].createtime}}</div>
                    <div>{{=it.vaccine[i].remark}}</div>
                </div>
                {{}}}
            </div>
            <div class="arrow_down padding_h_15 border_b from_nav">成本记录<span class="padding_l_15 danger">共{{=it.costs.length}}次，总计花费{{=it.totalcost}}元</span></div>
            <div class="padding_h_15 font_12 hide lineheight_2">
                {{for(var i=0;i<it.costs.length;i++){}}
                <div class="padding_v_10 border_b">
                    <div class="h_justify">
                        <div>{{=it.costs[i].title}}</div>
                        <div class="danger">{{=it.costs[i].price}}元</div>
                    </div>
                    <div class="light">{{=it.costs[i].content}}</div>
                </div>
                {{}}}
            </div>
        </div>
    </script>
    <script>
        // 轮播模版
            var banner = <{$banner}>;
            loadswipe(banner)
        // 详情模版
            var detail = <{$detail}>;console.log(detail)
            var evaldetail = doT.template($("#detail_template").text());
            loaddata(".detail",evaldetail,detail)
        // 详情项打开关闭特效
            $(".from_nav").click(function(){
                $(this).toggleClass("arrow_down arrow_up").next().toggle()
            })
        // 头部
            loadheadbar("仔猪详情",1)
    </script>
</body>
</html>
